package old;

//建造汽车
class Car {
    private Framework framework;
    public Car(int size) {
        this.framework = new Framework(size);
    }
    public void init() {
        System.out.println("调用了Car的init方法");
        framework.init();
    }
}

//建造框架
class Framework {
    private Bottom bottom;
    public Framework(int size) {
        this.bottom = new Bottom(size);
    }
    public void init() {
        System.out.println("调用了Framework的init方法");
        bottom.init();
    }
}

//建造地盘
class Bottom {
    private Tire tire;
    public Bottom(int size) {
        this.tire = new Tire(size);
    }
    public void init() {
        System.out.println("调用了Bottom的init方法");
        tire.init();
    }
}

//建造轮胎
class Tire {
    private int size;
    public Tire(int size) {
        this.size = size;
    }
    public void init() {
        System.out.println("调用了Tire的init方法,车轮的长度为:" + size);
    }
}

public class Application {
    public static void main(String[] args) {
        Car car = new Car(20);
        car.init();
    }
}


